package com.jstide.credit.data.service.biz;

import cn.hutool.core.util.StrUtil;
import cn.hutool.db.Entity;
import com.jstide.credit.data.service.Algorithm;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.ResultSet;
import java.util.List;
import java.util.Optional;

public class Factor11 extends Algorithm {

    public static final Logger logger = LoggerFactory.getLogger(Factor11.class);

    @Getter
    public final  String name="11";

    //驾驶人基本信息
    //“准驾车型A”20分；“准驾车型B”15分；“准驾车型C”10分；其他5分；
    //20
    @Getter
    public  final String sql ="    select ZJCX from ZRRJSRJBXX where join_id=@joinId    ";
    @Getter
    public final int defaultScore=50;

    @Override
    public int translate(String rs) {
        return 0;
    }


    @Override
    public int translate(List<Entity> rs) {
        int score = 0;
        if(null!=rs && rs.size()>0){
            String zjcx = rs.get(0).getStr("ZJCX");
            if(StrUtil.isNotBlank(zjcx)) {
                switch (zjcx) {
                    case "准驾车型A":
                        score = 30;
                        break;
                    case "准驾车型B":
                        score = 15;
                        break;
                    case "准驾车型C":
                        score = 10;
                        break;
                    default:
                        score = 5;
                        break;
                }
            }
       }
       return score;
    }
}
